#include<iostream>
#include<fstream>
#include<cstdlib>
#include<string>
using namespace std;

int main()
{
	string filename1,filename2;
	cout<<"请输入加密文件名：";
	cin >> filename1;
	cout<<"请输入解密后输出文件名：";
	cin >> filename2;
	ifstream infile(filename1,ios::in);
	if(!infile)
	{
		cout<<"无法打开加密文件"<<endl;
		exit(0);
	}
	ofstream outfile(filename2,ios::binary);
	if(!outfile)
	{
		cout<<"无法打开解密文件"<<endl;
		exit(0);
	}
	char ch;
	while(infile.get(ch))
	{
		ch-=2;
		outfile.put(ch);
	}
	cout << "解密完成，结果已写入 " << filename2<<endl;
	return 0;
}
/*测试样例
C:\\Users\\醣玖\\Desktop\\第三次作业\\第八题\\jiami.txt
*/